widgetCrombsCount = new dynamicWidget("widgetCrombsCount", "Crombs<br>Near You", "TEXT~", "updateCrombsCount(~~icon)", 5000, "renderCrombsCount()", "initCrombsCount(~~icon,~~widget)")
//widgetCrombsCount.display()

var direction = 0;
function initCrombsCount(iconID,elementID) {
    //console.log("Init element CrombsCount");
    updateCrombsCount(iconID);
    $("#"+elementID).css({
    	"font-size":"25px"
    });
}

function renderCrombsCount() {
    setTimeout(showWalletCrombs, 0);
}

function updateCrombsCount(elementID) {
    //console.log("Update element CrombsCount");
    setTimeout(function() {
        var count = undefined;
        if (lastCrombs !== undefined){
            count = lastCrombs.length;
        }
        if(count > oldCount){
            makeAlert("I Found "+ (count-oldCount) + " More Crombz Near You!");
            oldCount = count;
        }else if(count < oldCount){
            makeAlert("You Moved Away From "+(oldCount-count)+" Crombz!");
            oldCount = count;
        }
        var element = document.getElementById(elementID);
        if (count === undefined) {
            count = "...";
        } else {
            element.innerHTML = count;
        }
    }, 0);
}
